var token = localStorage.getItem("key")
var loginData = JSON.parse(localStorage.getItem("LoginData"))
var birth = loginData.birthday
function backIndex(){
	var newBirth = $("#birthday").val()
	if(birth!=newBirth){
		upSug()	
	}else{
		window.location.href='home.html?bool=true'
	}
}

function upSug() {
	var newBirth = $("#birthday").val()
	$.ajax({
        type: "POST",
        url: url_prefix + "user/update_birthday",
        data: {
        	request: JSON.stringify({
				birthday: newBirth,
				userId: loginData.id,
				token: token
			})   
        },
        dataType: "json",
        success: function(data){
        	//plus.nativeUI.toast(data.message, {verticalAlign: 'center'});
        	if (data.code == '300'){
				mui.toast("帐号在其他设备上登录")
				window.location.href="fastLogin.html"
			} else if (data.code == '200') {
				loginData.birthday = newBirth
				localStorage.setItem('LoginData', JSON.stringify(loginData));
				window.location.href='home.html?bool=true'
			} else {
				mui.toast(data.message)
			}
        }
    });
}